//
//  DCLoanDetialController.m
//  Demo
//
//  Created by Kyle on 2022/12/31.
//

#import "DCLoanDetialController.h"
#import "DCLoanDetialCell.h"
#import "DCOrderModel.h"
#import "DCOrderDetialModel.h"
#import "DCLoanExtensionController.h"

@interface DCLoanDetialController ()<UITableViewDelegate,UITableViewDataSource>

@property (nonatomic, strong) UITableView *tableView;

@property (nonatomic, strong) UILabel *moneyLabel;

@property (nonatomic, strong) UILabel *daysNumLabel;

@property (nonatomic, strong) UIButton *statusBtn;

@property (nonatomic, strong) UILabel *detialTypeLabel;
@property (nonatomic, strong) NSMutableArray *dataSource;

@property (nonatomic, strong) DCOrderDetialModel *model;
@end

@implementation DCLoanDetialController

- (void)viewDidLoad {
    [super viewDidLoad];
    [self setTitleName:@"Loan Details"];
    [self getDataFromNet];
    // Do any additional setup after loading the view.
}

- (void)configureAlloc {
    [super configureAlloc];
    self.dataSource = @[].mutableCopy;
}

- (void)configureUI {
    [super configureUI];
    self.navgitBar.backgroundColor = [UIColor colorWithString:@"#F0FFCE"];
//    self.view.backgroundColor = [UIColor colorWithString:@"#F0FFCE"];
    UIButton *privacyAgreementBtn = [UIButton buttonWithType:UIButtonTypeCustom];
    [privacyAgreementBtn setTitle:@"《Privacy Agreement》" forState:UIControlStateNormal];
    [privacyAgreementBtn addTarget:self action:@selector(privacyAgreementBtnAction:) forControlEvents:UIControlEventTouchUpInside];
    [privacyAgreementBtn setTitleColor:[UIColor colorWithString:@"#000000"] forState:UIControlStateNormal];
    privacyAgreementBtn.titleLabel.font = DCFont_PF_Regular(11);
    [self.view addSubview:privacyAgreementBtn];
    [privacyAgreementBtn mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerX.mas_equalTo(self.view.mas_centerX);
        make.bottom.mas_equalTo(-KSafeAreaInset.bottom-20);
        make.height.mas_equalTo(16);
    }];
    
    self.tableView = [[UITableView alloc] initWithFrame:CGRectZero style:UITableViewStylePlain];
    [self.tableView registerClass:DCLoanDetialCell.class forCellReuseIdentifier:NSStringFromClass(DCLoanDetialCell.class)];
    self.tableView.delegate = self;
    self.tableView.dataSource = self;
    self.tableView.backgroundColor = self.view.backgroundColor ;
    self.tableView.backgroundColor = [UIColor colorWithString:@"#FFFFFF"];
    self.tableView.showsVerticalScrollIndicator = NO;
    self.tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
    [self.view addSubview:self.tableView];
    [self.tableView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(self.navgitBar.mas_bottom);
        make.left.right.mas_equalTo(0);
        make.bottom.mas_equalTo(privacyAgreementBtn.mas_top).mas_offset(-10);
    }];
    
    UIView *headerView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, kScreenWidth, 286 + 20 +KSafeAreaInset.top)];;
    self.tableView.tableHeaderView = headerView;
    
    UIView *colorView = [UIView new];
    colorView.backgroundColor = [UIColor colorWithString:@"#F0FFCE"];
    [headerView addSubview:colorView];
    [colorView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.right.top.mas_equalTo(0);
        make.height.mas_equalTo(154+KSafeAreaInset.top);
    }];
        
    UIView *cornerRadiusView = [UIView new];
    cornerRadiusView.backgroundColor = [UIColor colorWithString:@"#FFFFFF"];
    cornerRadiusView.layer.cornerRadius = 30;
    cornerRadiusView.layer.masksToBounds = YES;
    [headerView addSubview:cornerRadiusView];
    [cornerRadiusView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.left.mas_equalTo(0);
        make.height.mas_equalTo(60);
        make.bottom.mas_equalTo(colorView.mas_bottom);
    }];
    
    UIImageView *colorImage = [UIImageView new];
    colorImage.layer.cornerRadius = 8;
    colorImage.layer.masksToBounds = YES;
    colorImage.backgroundColor = [UIColor colorWithString:@"#1C221B"];
    [colorView addSubview:colorImage];
    [colorImage mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(36);
        make.bottom.mas_equalTo(cornerRadiusView.mas_top).mas_offset(-33);
        make.width.height.mas_equalTo(36);
    }];
    
    UILabel *numberLabel = [UILabel new];
    numberLabel.text = @"009900";
    numberLabel.textColor = [UIColor colorWithString:@"#1C221B"];
    numberLabel.font = DCFont_PF_Medium(14);
    [colorView addSubview:numberLabel];
    [numberLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(colorImage.mas_right).mas_offset(10);
        make.centerY.mas_equalTo(colorImage.mas_centerY);
    }];
    
    UIButton *statusBtn = [UIButton buttonWithType:UIButtonTypeCustom];
    _statusBtn = statusBtn;
    statusBtn.titleLabel.font = DCFont_PF_Medium(14);
    [statusBtn setTitle:@"Extension" forState:UIControlStateNormal];
    [statusBtn setTitleColor:[UIColor colorWithString:@"#658900"] forState:UIControlStateNormal];
    [colorView addSubview:statusBtn];
    [statusBtn mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.mas_equalTo(-36);
        make.centerY.mas_equalTo(colorImage.mas_centerY);
        make.height.mas_equalTo(30);
    }];
    
    UIView *whiteView = [UIView new];
//    whiteView.backgroundColor = [UIColor cyanColor];
    whiteView.backgroundColor = [UIColor colorWithString:@"#FFFFFF"];
    [headerView addSubview:whiteView];
    [whiteView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.right.bottom.mas_equalTo(0);
        make.top.mas_equalTo(cornerRadiusView.mas_centerY);
    }];
    
    UILabel *moneyDes = [UILabel new];
    moneyDes.font = DCFont_PF_Light(12);
    moneyDes.text = @"Amount";
    moneyDes.textColor = [UIColor colorWithString:@"#1C221B"];
    [whiteView addSubview:moneyDes];
    [moneyDes mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(13);
        make.left.mas_equalTo(46);
    }];
    
    UILabel *moneyLabel = [UILabel new];
    _moneyLabel = moneyLabel;
    moneyLabel.font = DCFont_PF_Medium(26);
    moneyLabel.text = @"₦3,000";
    moneyLabel.textColor = [UIColor colorWithString:@"#1C221B"];
    [whiteView addSubview:moneyLabel];
    [moneyLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(moneyDes);
        make.top.mas_equalTo(moneyDes.mas_bottom).mas_offset(10);
    }];
    
    UILabel *dateDes = [UILabel new];
    dateDes.font = DCFont_PF_Light(12);
    dateDes.text = @"Duration";
    dateDes.textColor = [UIColor colorWithString:@"#1C221B"];
    [whiteView addSubview:dateDes];
    [dateDes mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(13);
        make.right.mas_equalTo(-46);
    }];
    
    
    
    UILabel *dayLabel = [UILabel new];
    dayLabel.font = DCFont_PF_Regular(16);
    dayLabel.textColor = [UIColor colorWithString:@"#1C221B"];
    dayLabel.text = @"days";
    [whiteView addSubview:dayLabel];
    [dayLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.mas_equalTo(dateDes);
        make.bottom.mas_equalTo(moneyLabel.mas_bottom).mas_offset(-2);
    }];
    
    UILabel *dateLabel = [UILabel new];
    _daysNumLabel = dateLabel;
    dateLabel.font = DCFont_PF_Medium(26);
    dateLabel.text = @"120";
    dateLabel.textColor = [UIColor colorWithString:@"#1C221B"];
    [whiteView addSubview:dateLabel];
    [dateLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.mas_equalTo(dayLabel.mas_left);
        make.bottom.mas_equalTo(dayLabel.mas_bottom).mas_offset(2);
    }];
    
    UIView *lineView = [UIView new];
    lineView.backgroundColor = [UIColor colorWithString:@"#1C221B"];
    [whiteView addSubview:lineView];
    [lineView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(moneyLabel.mas_bottom).mas_offset(26);
        make.left.mas_equalTo(31);
        make.right.mas_equalTo(-31);
        make.height.mas_equalTo(1);
    }];
    
    UIImageView *logoImage = [UIImageView new];
    logoImage.image = [UIImage imageNamed:@"wodedingdan"];
//    logoImage.backgroundColor = [UIColor redColor];
    [whiteView addSubview:logoImage];
    [logoImage mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(42);
        make.top.mas_equalTo(lineView.mas_bottom).mas_offset(35);
        make.width.height.mas_equalTo(25);
    }];
    
    UILabel *detialLabel = [UILabel new];
    _detialTypeLabel = detialLabel;
    detialLabel.text = @"Loan Details";
    detialLabel.textColor = [UIColor colorWithString:@"#1C221B"];
    detialLabel.font = DCFont_PF_Medium(15);
    [whiteView addSubview:detialLabel];
    [detialLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.mas_equalTo(logoImage.mas_centerY);
        make.left.mas_equalTo(logoImage.mas_right).mas_offset(10);
    }];

}

- (UIView *)tableViewFooter {
    UIView *footerView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, kScreenWidth, 200)];
    footerView.backgroundColor = [UIColor colorWithString:@"#FFFFFF"];
    UIButton *extensionBtn = [UIButton buttonWithType:UIButtonTypeCustom];
    extensionBtn.layer.cornerRadius = 8;
    extensionBtn.layer.masksToBounds = YES;
    extensionBtn.backgroundColor = [UIColor colorWithString:@"#1C221B"];
    extensionBtn.titleLabel.font = DCFont_PF_Semibold(15);
    [extensionBtn setTitleColor:[UIColor colorWithString:@"#FFFFFF"] forState:UIControlStateNormal];
    [extensionBtn setTitle:@"Apply for extension" forState:UIControlStateNormal];
    [extensionBtn addTarget:self action:@selector(extensionBtnAtion:) forControlEvents:UIControlEventTouchUpInside];
    [footerView addSubview:extensionBtn];
    [extensionBtn mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(38);
        make.bottom.mas_equalTo(footerView.mas_centerY).mas_offset(-10);
        make.right.mas_equalTo(-38);
        make.height.mas_equalTo(50);
    }];
    
    UIButton *repayBtn = [UIButton buttonWithType:UIButtonTypeCustom];
    repayBtn.layer.cornerRadius = 8;
    repayBtn.layer.masksToBounds = YES;
    repayBtn.backgroundColor = [UIColor colorWithString:@"#E1FE97"];
    repayBtn.titleLabel.font = DCFont_PF_Semibold(15);
    [repayBtn setTitleColor:[UIColor colorWithString:@"#000000"] forState:UIControlStateNormal];
    [repayBtn setTitle:@"Repay now" forState:UIControlStateNormal];
    [repayBtn addTarget:self action:@selector(repayBtnAtion:) forControlEvents:UIControlEventTouchUpInside];
    [footerView addSubview:repayBtn];
    [repayBtn mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(footerView.mas_centerY).mas_offset(10);
        make.left.mas_equalTo(38);
        make.right.mas_equalTo(-38);
        make.height.mas_equalTo(50);
    }];
    
//    UIButton *configure
    return footerView;
}

- (void)getDataFromNet {
    [DCHttpRequest DCOrderDetialWithOrderNo:_orderModel.orderNo complate:^(NSURLSessionDataTask * _Nonnull operation, DCResponseData * _Nonnull responseObject) {
        DLog(@"%@",responseObject.data);
        if (responseObject.code == 200) {
            self.model = [DCOrderDetialModel mj_objectWithKeyValues:responseObject.data];
            [self analysisLoanData];
            DLog(@"%@",self.model);
        } else {
            [DCDCToast toastText:responseObject.message];
        }
    }];
}

- (void)analysisLoanData {
    //Under review 审核中
    //Transfering 放款中
    //Transfer failed 放款失败
    //Repaid 已还
    //Overdue 逾期待还款
    //Unpaid 待还款
    //Extension 展期
    //Rejected 被拒
    //状态90：审批中,100：审批通过,110：审批不通过,150：放款中,169：放款失败,170：放款成功,180：逾期,200：贷款结清
    
    switch ([_model.status intValue]) {
        case 90:
            //审批中
        {
            [_statusBtn setTitle:@"Under review" forState:UIControlStateNormal];
            NSDate* date=[NSDate dateWithTimeIntervalSince1970:[_model.ctime longLongValue] /1000];
            NSDateFormatter *formatter = [[NSDateFormatter alloc] init];
            [formatter setDateFormat:@"dd-MM-yyyy"];
            NSString *dateStr = [formatter stringFromDate:date];
            
            NSString *loanAmount = [NSString stringWithFormat:@"₦ %@",_model.loanAmount];
            NSString *days = [NSString stringWithFormat:@"%@ days",_model.term];
            NSString *bankName = [NSString stringWithFormat:@"₦ %@",_model.bankName];
            NSString *bankAccount = [NSString stringWithFormat:@"₦ %@",_model.bankCard];
            
            self.dataSource = @[@{@"leftText":@"Application Date",@"rightText":dateStr},
                                @{@"leftText":@"Application amount",@"rightText":loanAmount},
                                @{@"leftText":@"Loan duration",@"rightText":days},
                                @{@"leftText":@"Bank name",@"rightText":bankName},
                                @{@"leftText":@"Bank account",@"rightText":bankAccount}].mutableCopy;
        }
            break;
        case 100:
            //审批通过
        {
            [_statusBtn setTitle:@"Transfering" forState:UIControlStateNormal];
            NSDate* date=[NSDate dateWithTimeIntervalSince1970:[_model.ctime longLongValue] /1000];
            NSDateFormatter *formatter = [[NSDateFormatter alloc] init];
            [formatter setDateFormat:@"dd-MM-yyyy"];
            NSString *dateStr = [formatter stringFromDate:date];
            
            NSString *loanAmount = [NSString stringWithFormat:@"₦ %@",_model.loanAmount];
            NSString *days = [NSString stringWithFormat:@"%@ days",_model.term];
            NSString *bankName = [NSString stringWithFormat:@"₦ %@",_model.bankName];
            NSString *bankAccount = [NSString stringWithFormat:@"₦ %@",_model.bankCard];
            
            self.dataSource = @[@{@"leftText":@"Application Date",@"rightText":dateStr},
                                @{@"leftText":@"Application amount",@"rightText":loanAmount},
                                @{@"leftText":@"Loan duration",@"rightText":days},
                                @{@"leftText":@"Bank name",@"rightText":bankName},
                                @{@"leftText":@"Bank account",@"rightText":bankAccount}].mutableCopy;
        }
            break;
        case 110:
            //审批不通过
        {
            [_statusBtn setTitle:@"Rejected" forState:UIControlStateNormal];
            NSDate* date=[NSDate dateWithTimeIntervalSince1970:[_model.ctime longLongValue] /1000];
            NSDateFormatter *formatter = [[NSDateFormatter alloc] init];
            [formatter setDateFormat:@"dd-MM-yyyy"];
            NSString *dateStr = [formatter stringFromDate:date];
            
            NSString *loanAmount = [NSString stringWithFormat:@"₦ %@",_model.loanAmount];
            NSString *days = [NSString stringWithFormat:@"%@ days",_model.term];
            NSString *bankName = [NSString stringWithFormat:@"%@",_model.bankName];
            NSString *bankAccount = [NSString stringWithFormat:@"%@",_model.bankCard];
            
            self.dataSource = @[@{@"leftText":@"Application Date",@"rightText":dateStr},
                                @{@"leftText":@"Application amount",@"rightText":loanAmount},
                                @{@"leftText":@"Loan duration",@"rightText":days},
                                @{@"leftText":@"Bank name",@"rightText":bankName},
                                @{@"leftText":@"Bank account",@"rightText":bankAccount}].mutableCopy;
        }
            break;
        case 150:
            // 放款中
        {
            [_statusBtn setTitle:@"Transfering" forState:UIControlStateNormal];
            NSDate* date=[NSDate dateWithTimeIntervalSince1970:[_model.ctime longLongValue] /1000];
            NSDateFormatter *formatter = [[NSDateFormatter alloc] init];
            [formatter setDateFormat:@"dd-MM-yyyy"];
            NSString *dateStr = [formatter stringFromDate:date];
            
            NSString *repaymentAmount = [NSString stringWithFormat:@"₦ %@",_model.repayAmount];
            NSString *principal = [NSString stringWithFormat:@"₦ %@",_model.principalAmount];
            NSString *interest = [NSString stringWithFormat:@"₦ %@",_model.interestAmount];
            NSString *penalty = [NSString stringWithFormat:@"₦ %@",_model.interestAmount];
            
            self.dataSource = @[@{@"leftText":@"Due date",@"rightText":dateStr},
                                @{@"leftText":@"Repayment amount",@"rightText":repaymentAmount},
                                @{@"leftText":@"Principal",@"rightText":principal},
                                @{@"leftText":@"Interest",@"rightText":interest},
                                @{@"leftText":@"Penalty",@"rightText":penalty}].mutableCopy;

        }
            break;
        case 169:
            //放款失败
        {
            [_statusBtn setTitle:@"Transfer failed" forState:UIControlStateNormal];
            [_statusBtn setTitleColor:[UIColor colorWithString:@"#C70000"] forState:UIControlStateNormal];
            NSDate* date=[NSDate dateWithTimeIntervalSince1970:[_model.ctime longLongValue] /1000];
            NSDateFormatter *formatter = [[NSDateFormatter alloc] init];
            [formatter setDateFormat:@"dd-MM-yyyy"];
            NSString *dateStr = [formatter stringFromDate:date];
            
            NSString *repaymentAmount = [NSString stringWithFormat:@"₦ %@",_model.repayAmount];
            NSString *principal = [NSString stringWithFormat:@"₦ %@",_model.principalAmount];
            NSString *interest = [NSString stringWithFormat:@"₦ %@",_model.interestAmount];
            NSString *penalty = [NSString stringWithFormat:@"₦ %@",_model.interestAmount];
            
            self.dataSource = @[@{@"leftText":@"Due date",@"rightText":dateStr},
                                @{@"leftText":@"Repayment amount",@"rightText":repaymentAmount},
                                @{@"leftText":@"Principal",@"rightText":principal},
                                @{@"leftText":@"Interest",@"rightText":interest},
                                @{@"leftText":@"Penalty",@"rightText":penalty}].mutableCopy;
        }
            break;
        case 170:
            //放款成功
        {
            [_statusBtn setTitle:@"Transfer success" forState:UIControlStateNormal];
            NSDate* date=[NSDate dateWithTimeIntervalSince1970:[_model.ctime longLongValue] /1000];
            NSDateFormatter *formatter = [[NSDateFormatter alloc] init];
            [formatter setDateFormat:@"dd-MM-yyyy"];
            NSString *dateStr = [formatter stringFromDate:date];
            
            NSString *repaymentAmount = [NSString stringWithFormat:@"₦ %@",_model.repayAmount];
            NSString *principal = [NSString stringWithFormat:@"₦ %@",_model.principalAmount];
            NSString *interest = [NSString stringWithFormat:@"₦ %@",_model.interestAmount];
            NSString *penalty = [NSString stringWithFormat:@"₦ %@",_model.interestAmount];
            
            self.dataSource = @[@{@"leftText":@"Due date",@"rightText":dateStr},
                                @{@"leftText":@"Repayment amount",@"rightText":repaymentAmount},
                                @{@"leftText":@"Principal",@"rightText":principal},
                                @{@"leftText":@"Interest",@"rightText":interest},
                                @{@"leftText":@"Penalty",@"rightText":penalty}].mutableCopy;

        }
            break;
        case 180:
            //逾期
        {
            [_statusBtn setTitle:@"Overdue" forState:UIControlStateNormal];
            _detialTypeLabel.text  = @"Repayment details";
            NSDate* date=[NSDate dateWithTimeIntervalSince1970:[_model.expiryTime longLongValue] /1000];
            NSDateFormatter *formatter = [[NSDateFormatter alloc] init];
            [formatter setDateFormat:@"dd-MM-yyyy"];
            NSString *dateStr = [formatter stringFromDate:date];
            
            NSString *repaymentAmount = [NSString stringWithFormat:@"₦ %@",_model.repayAmount];
            NSString *principal = [NSString stringWithFormat:@"₦ %@",_model.principalAmount];
            NSString *interest = [NSString stringWithFormat:@"₦ %@",_model.interestAmount];
            NSString *penalty = [NSString stringWithFormat:@"₦ %@",_model.expiryAmount];
            
            self.dataSource = @[@{@"leftText":@"Due date",@"rightText":dateStr},
                                @{@"leftText":@"Repayment amount",@"rightText":repaymentAmount},
                                @{@"leftText":@"Principal",@"rightText":principal},
                                @{@"leftText":@"Interest",@"rightText":interest},
                                @{@"leftText":@"Penalty",@"rightText":penalty}].mutableCopy;
        }
            break;
        case 200:
            //贷款结清
        {
            [_statusBtn setTitle:@"Repaid" forState:UIControlStateNormal];
            NSDate* date=[NSDate dateWithTimeIntervalSince1970:[_model.ctime longLongValue] /1000];
            NSDateFormatter *formatter = [[NSDateFormatter alloc] init];
            [formatter setDateFormat:@"dd-MM-yyyy"];
            NSString *dateStr = [formatter stringFromDate:date];
            
            NSString *repaymentAmount = [NSString stringWithFormat:@"₦ %@",_model.repayAmount];
            NSString *principal = [NSString stringWithFormat:@"₦ %@",_model.principalAmount];
            NSString *interest = [NSString stringWithFormat:@"₦ %@",_model.interestAmount];
            NSString *penalty = [NSString stringWithFormat:@"₦ %@",_model.interestAmount];
            
            self.dataSource = @[@{@"leftText":@"Due date",@"rightText":dateStr},
                                @{@"leftText":@"Repayment amount",@"rightText":repaymentAmount},
                                @{@"leftText":@"Principal",@"rightText":principal},
                                @{@"leftText":@"Interest",@"rightText":interest},
                                @{@"leftText":@"Penalty",@"rightText":penalty}].mutableCopy;
        }
            break;
            
        default:
        {
            [_statusBtn setTitle:@"" forState:UIControlStateNormal];
        }
            break;
    }
    _daysNumLabel.text = self.model.term;
    _moneyLabel.text = [NSString stringWithFormat:@"₦%@",_model.loanAmount];
    //170：放款成功,180：逾期
    if (([_model.status isEqualToString:@"170"]  || [_model.status isEqualToString:@"180"]) && [_model.delayStatus isEqualToString:@"1"]) {
        self.tableView.tableFooterView = [self tableViewFooter];
    }
    [self.tableView reloadData];
}

#pragma mark - tableView
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
    return self.dataSource.count;
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
    DCLoanDetialCell *cell = [tableView dequeueReusableCellWithIdentifier:NSStringFromClass(DCLoanDetialCell.class)];
    NSDictionary *dic = [self.dataSource objectAtIndex:indexPath.row];
    [cell configureData:dic];
    return cell;
}

- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {
    return 35;
}

- (void)privacyAgreementBtnAction:(UIButton *)sender {
    DCWebModel *webInfo = [DCWebModel creatPrivacyAgreement];
    DCWebViewController *webVC = [[DCWebViewController alloc] initWithModel:webInfo];
    [self.navigationController pushViewController:webVC animated:YES];
}

- (void)repayBtnAtion:(UIButton *)sender {
    
}

- (void)extensionBtnAtion:(UIButton *)sender {
    DCLoanExtensionController *vc = [[DCLoanExtensionController alloc] init];
    [self.navigationController pushViewController:vc animated:YES];
}
/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
